package com.qili.controller.supervisor;

import com.qili.base.controller.BaseController;
import com.qili.entity.supervisor.SupervisorProjectPay;
import com.qili.entity.supervisor.dto.SupervisorProjectPayDTO;
import com.qili.service.supervisor.SupervisorProjectPayService;
import com.qili.util.ReType;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author Zhangshuo
 * @date 2020/11/23 17:47
 **/
@Controller
@RequestMapping("/supervisor/pay")
public class ProjectPayController extends BaseController {

    @Autowired
    SupervisorProjectPayService supervisorProjectPayService;


    @ResponseBody
    @GetMapping(value = "/getlistbyprjid")
    public ReType getPaysByProjectId(SupervisorProjectPay supervisorProjectPay) {
        ReType re = new ReType();
        try {
            SupervisorProjectPayDTO  dto=new SupervisorProjectPayDTO();
            dto.setSppPrjid(supervisorProjectPay.getSppPrjid());
            List<SupervisorProjectPayDTO> AlistData = supervisorProjectPayService.selectSupervisorProjectPay(dto);
      /*      AlistData.sort(new Comparator<SupervisorProjectPay>() {
                @Override
                public int compare(SupervisorProjectPay o1, SupervisorProjectPay o2) {
                    return Integer.valueOf(o1.getSppNo()) - Integer.valueOf(o2.getSppNo());
                }
            });*/
            re.setCode(0);
            re.setData(AlistData);
        } catch (Exception e) {
            e.printStackTrace();
            re.setCode(500);
            re.setMsg("根据项目编号获取付款方式异常！！" + e.getMessage());
        }
        return re;
    }

}
